package com.rockcent.mall.lib.repository;
import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.Topic;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import java.util.List;

/**
 * Created by zhangjh on 2016/10/15.
 */
@Repository
public interface TopicRepository extends JpaRepository<Topic, Long>, JpaSpecificationExecutor, TopicRepositoryCustom {

    List<Topic> findByMallIdAndIsDeleteOrderBySeqNoAsc(Long mallId, Whether isDelete);

    Topic findByIdAndMallIdAndIsDelete(Long id, Long mallId, Whether no);

    List<Topic> findByTitleAndMallIdAndIsDeleteOrderBySeqNoAsc(String title, Long mallId, Whether no);


    Topic findTop1ByMallIdAndIsDeleteOrderBySeqNoDesc(Long mallId, Whether no);

    Topic findByIdAndIsDelete(Long id, Whether no);

    List<Topic> findByTitleAndIsDeleteOrderBySeqNoAsc(String title, Whether no);

    List<Topic> findByIsDeleteOrderBySeqNoAsc(Whether no);

    Topic findTop1ByIsDeleteOrderBySeqNoDesc(Whether no);


}
